home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: seebs@solutions.solon.com (Peter Seebach)
- Newsgroups: comp.edu,comp.lang.c,comp.lang.c++
- Subject: Re: C or C++ for a 14-year old? The definitive reply
- Date: 24 Jan 1996 12:16:12 -0600
- Organization: Usenet Fact Police (Undercover)
- Message-ID: <4e5t1c$71c@solutions.solon.com>
- References: <4cve3a$f0n@news.iconn.net> <qq91jhhtbr.fsf@tartarus.ucsd.edu> <4danli$llb@news.onramp.net> <4e3mvdINNpi3@mayne.ugrad.cs.ubc.ca>
- NNTP-Posting-Host: solutions.solon.com
-
- In article <4e3mvdINNpi3@mayne.ugrad.cs.ubc.ca>,
- Kazimir Kylheku <c2a192@ugrad.cs.ubc.ca> wrote:
- >I know about those things, and can practice most of them under C.
- >It's not entirely clear that any real benefits are derived from frills like
- >language support for polymorphism and inheritance.
-
- This, I would at least partially agree with. I've been using perl for my
- OO recently, and I'm happy with it.
-
- >Information hiding leads to inefficiencies---and you _can_ have it in C, by the
- >way. Even the C preprocessor lets you have efficient information hiding, if you
- >use it with discipline. It's cheaper to access elements of a function via
- >macros than be forced to communicate via abstract function calls. The only
- >advantage that information hiding gives you is that 1) you can change the
- >implementation of the data structure easily without recompiling modules that
- >use it (big deal). 2) you have more control over how your software gets used. I
- >think it's point 2 that is the chief motivation, because it allows capitalists
- >to have better control over the production and trade of software.
-
- Huh?
-
- Point 1 is, in fact, a *very* big deal. The larger the project, the more
- important it is that a complete rewrite of the internals of one part not
- break anything.
-
- I'm not quite sure what you mean by point 2.
-
- The abstract function calls have the additional advantage that, for almost
- any non-trivial task, they make solid the distinction between interface
- and implementation. When I was a kid, I just used internals of the
- representations I had chosen. Modifications were hell. When I first
- tried just the primitive enhancement of using a simple function for
- every common access, the next rewrite took me an hour for the internals,
- and 5 minutes for the interface. And it *all* worked.
-
- Haven't looked back since.
-
- >The concepts of object oriented design and programming transcend the choice of
- >programming language. Once can practice sound OO design with C, if one is so
- >inclined.
-
- True enough. The advantage of, say, C++, is that the squiggly bits are
- already done for you. The disadvantage of C++ in particular is that the
- language is utterly huge, and takes a *long* time to learn well. (It
- has been argued that it's ugly. I don't entirely buy it. Some of the
- code people write in C++ looks pretty bad, some looks pretty good. I
- don't think it's as pretty as C, but I have never seen a more complex language
- look as pretty as a simpler language. Code in it can often be much more
- elegant at the source level.)
-
- Good OO design is, of course, not the only or ideal goal. Some problems
- are better addressed with other solutions.
-
- -s
- --
- Peter Seebach - seebs@solon.com - Copyright 1995 Peter Seebach.
- C/Unix proto-wizard -- C/Unix questions? Send mail for help. No, really!
- Using trn? Weird new newsgroup problem? I know the fix! Email me!
- The *other* C FAQ - ftp taniemarie.solon.com /pub/c/afq - Not A Flying Toy
-